import argparse

import mindspore.numpy
import numpy as np
from mindspore import load_checkpoint, Tensor

parser = argparse.ArgumentParser(description='DeepSpeech ckpt test')

parser.add_argument('--pretrain_ckpt', type=str, default='', help='Pretrained checkpoint path')

args = parser.parse_args()

paras = load_checkpoint(args.pretrain_ckpt)
for para in paras.values():
    x = Tensor(para).asnumpy()

    print(np.isnan(x).any(), np.isinf(x).any())
    # if np.sum(Tensor(para) != Tensor(para)) != 0:
    #     print('nan is in test')
    input('wait')
